 ///
 /// @file    template.cc
 /// @author  lemon(haohb13@gmail.com)
 /// @date    2016-03-07 11:39:21
 ///
 
#include <iostream>

using std::cout;
using std::endl;

// 普通函数优先于函数模板的执行
int max(int i1, int i2)
{
	cout << "Normal max:" << endl;
	return i1 > i2 ? i1 : i2;
}

template <typename T>
T max(T t1, T t2)
{
	cout << "Template max:" << endl;
	return t1 > t2 ? t1 : t2;
}


int main(void)
{
	int i1 = 2, i2 = 9;
	char c1 = 'a';
	char c2 = 'b';
	int iRet = max(i1, i2);//调用普通函数
	char cRet = max(c1, c2);

	int iRet2 = max(c1, c2);
	int cRet2 = max<char>(i1, i2);//调用模板函数
}
